
[dbo].[asi_DocumentCreateShortcut]
CREATE PROCEDURE [dbo].[asi_DocumentCreateShortcut]
@folderHierarchyKey uniqueidentifier,
@documentVersionKey uniqueidentifier,
@userKey uniqueidentifier
AS
BEGIN
DECLARE @newDocumentKey uniqueidentifier, @newDocumentVersionKey uniqueidentifier, @documentKey uniqueidentifier
SET @newDocumentKey = NewID()
SET @newDocumentVersionKey = NewID()
INSERT INTO UniformRegistry (UniformKey, ComponentKey)
SELECT @newDocumentKey, ComponentKey
FROM ComponentRegistry
WHERE Name = 'Document'
AND InterfaceName = 'BusinessController'
INSERT INTO UniformRegistry (UniformKey, ComponentKey)
SELECT @newDocumentVersionKey, ComponentKey
FROM ComponentRegistry
WHERE Name = 'DocumentVersion'
AND InterfaceName = 'BusinessController'
EXEC asi_DocumentGetLatestKey @documentVersionKey, @documentKey OUT
INSERT INTO DocumentMain (
DocumentKey,
DocumentTypeCode,
DocumentName,
DocumentVersionKey,
DocumentStatusCode,
AlternateName,
IsSystem,
AccessKey,
ContainsChildrenFlag,
RelatedDocumentVersionKey,
StatusUpdatedByUserKey,
StatusUpdatedOn,
UpdatedByUserKey,
UpdatedOn,
CreatedByUserKey,
CreatedOn)
SELECT @newDocumentKey,
'SRT',
DocumentName,
@newDocumentVersionKey,
40,
AlternateName,
0,
AccessKey,
0,
@documentVersionKey,
@userKey,
GetDate(),
@userKey,
GetDate(),
@userKey,
GetDate()
FROM DocumentMain
WHERE DocumentKey = @documentKey
IF @@ROWCOUNT = 1
exec asi_DocumentLinkDocument @folderHierarchyKey, @newDocumentVersionKey
ELSE
SELECT null
END
GO